package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLdDj;
import com.huizu.project.service.IProLdDjService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 劳动等级配置Controller
 * 
 * @author zhangmx
 * @date 2024-05-11
 */
@RestController
@RequestMapping("/project/prolddj")
public class ProLdDjController extends BaseController
{
    @Autowired
    private IProLdDjService proLdDjService;

    /**
     * 查询劳动等级配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLdDj proLdDj)
    {
        startPage();
        List<ProLdDj> list = proLdDjService.selectProLdDjList(proLdDj);
        return getDataTable(list);
    }

    /**
     * 导出劳动等级配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:export')")
    @Log(title = "劳动等级配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLdDj proLdDj)
    {
        List<ProLdDj> list = proLdDjService.selectProLdDjList(proLdDj);
        ExcelUtil<ProLdDj> util = new ExcelUtil<ProLdDj>(ProLdDj.class);
        util.exportExcel(response, list, "劳动等级配置数据");
    }

    /**
     * 获取劳动等级配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLdDjService.selectProLdDjById(id));
    }

    /**
     * 新增劳动等级配置
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:add')")
    @Log(title = "劳动等级配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLdDj proLdDj)
    {
        return toAjax(proLdDjService.insertProLdDj(proLdDj));
    }

    /**
     * 修改劳动等级配置
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:edit')")
    @Log(title = "劳动等级配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLdDj proLdDj)
    {
        return toAjax(proLdDjService.updateProLdDj(proLdDj));
    }

    /**
     * 删除劳动等级配置
     */
    @PreAuthorize("@ss.hasPermi('project:prolddj:remove')")
    @Log(title = "劳动等级配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLdDjService.deleteProLdDjByIds(ids));
    }
}
